<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="x-ua-compatible" content="IE=edge, chrome=1">
    <title>j5shop商城</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link href="/street/css/zhuce.css" type="text/css" rel="stylesheet"/>
    <script type="text/javascript" src="/street/js/jquery-1.7.2.min.js"></script>
</head>
<body>
<!---------------头部----------------->
<div class="wt1080 top">
    <div class="logo"><a href="#"><img src="/street/image/logo.png"></a></div>
    <div class="rr">
        <ul>
            <li>
                <img src="/street/image/bg3.png">
                <p>全球正品货源</p>
            </li>
            <li>
                <img src="/street/image/bg5.png">
                <p>一件代发</p>
            </li>
            <li>
                <img src="/street/image/bg4.png">
                <p>全球直邮</p>
            </li>
            <li>
                <img src="/street/image/bg6.png">
                <p>售后无忧</p>
            </li>
        </ul>
    </div>
    <div class="clear"></div>
</div>
<!----------------------中间------------------------->
<div class="red">
    <form id="signupForm">
    <div class="wt1080 login">
        <div class="login_pic"><img src="/street/image/login.jpg"></div>
        <div class="l_k">
            <h1>新用户注册</h1>
            <div class="l_k_d">用户名：<input type="text" id="username" name="username" placeholder="邮箱/手机/用户名"></div>
            <div class="l_k_d">设置密码：<input type="text" id="password" name="password" placeholder="6-20个大小写英文字母、符号或数字"></div>
            <div class="l_k_d">确认密码：<input type="text" id="passwordRepeat" name="passwordRepeat" placeholder="请再次输入密码"></div>
            <div class="l_k_s">验证码：<input type="text" name="" placeholder="6位验证码"></div>
            <div class="verify">6Dte26</div>
            <p>点击注册，表示你同意洋店网<a href="#">《服务协议》</a></p>
            <button class="res">注册</button>
        </div>
        <div class="clear"></div>
    </div>
    </form>
</div>
<!-------------------底部------------------------>
<div class="foot wt1080">
    <ul>
        <li><a href="#">网站简介</a></li>
        <li><a href="#">联系我们</a></li>
        <li><a href="#">招商合作</a></li>
        <li><a href="#">销售联盟</a></li>
    </ul>
    <p>Copyright © 2016 洋店网.版权所有.备案号：京ICP证35124521号.技术支持：西部网络</p>
</div>
<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>



<!-- jQuery Validation plugin javascript-->
<script src="/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/js/plugins/validate/messages_zh.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        validateRule();
        //$("#signupForm").validate();
    });
    $.validator.setDefaults({
        submitHandler : function() {
            reg();
        }
    });

    function reg() {
        $.ajax({
            type : "POST",
            url : "/street/reg",
            data : $('#signupForm').serialize(),
            success : function(r) {
                if (r.code == 0) {
                    location.href = '/street/login';
                } else {
                    layer.msg(r.msg);
                }
            }
        });
    }

    function validateRule() {
        $("#signupForm").validate({
            rules : {
                username : {
                    required : true
                },
                password : {
                    required : true
                },
                passwordRepeat : {
                    required : true
                }
            },
            messages : {
                username : {
                    required :  "请输入您的用户名",
                },
                password : {
                    required : "请输入您的密码",
                },
                passwordRepeat : {
                    required : "请输入您的确认密码",
                }
            }
        })
    }
</script>
</body>
</html>
